<template>
  <el-timeline class="calibration-record" v-if="activities.length > 0">
    <el-timeline-item
      v-for="(activity, index) in activities"
      :key="index"
      placement="top"
      :timestamp="activity.timestamp"
    >
      <b-cell label="报警内容" :content="activity.alarmContent || ' -- '" />
      <b-cell label="报警原因" :content="activity.alarmReason || ' -- '" />
      <b-cell label="处理措施" :content="activity.alarmResult || ' -- '" />
    </el-timeline-item>
  </el-timeline>
  <b-empty></b-empty>
</template>
<script setup lang="ts">
import BCell from '@/components/b-cell.vue'
import { getSensorCalibrationList } from '@/api/alarm'
import { ref, onMounted } from 'vue'
import bEmpty from '@/components/b-empty.vue'

const props = defineProps({
  sensor: {
    type: Object as PropType<{
      cdCode: string
    }>,
    required: true
  }
})

const activities = ref([])

onMounted(() => {
  getSensorCalibrationListFun()
})

async function getSensorCalibrationListFun() {
  const { data } = await getSensorCalibrationList({
    cdCode: props.sensor.cdCode
  })
  activities.value = data
}
</script>

<style lang="scss" scoped>
.calibration-record {
  padding: 0 16px;
  :deep(.el-timeline-item__timestamp) {
    color: var(--color-white);
  }
  :deep(.el-timeline-item__content) {
    color: var(--color-white);
  }
}
</style>
